import React from 'react'
import MuxPlayer from '@mux/mux-player-react';

interface VideoPlayerProps {
    playbackId?: string | null
    thumbnailUrl?: string | null
    autoPlay?: boolean
    onPlay?: () => void
}

export default function VideoPlayer({ playbackId, thumbnailUrl, autoPlay, onPlay }: VideoPlayerProps) {

    return (
        <MuxPlayer
            playbackId={playbackId || ''}
            poster={thumbnailUrl || '/placeholder.svg'}
            playerInitTime={0}
            className='w-full h-full object-contain'
            thumbnailTime={0}
            autoPlay={autoPlay}
            accentColor='#ff2056'
            onPlay={onPlay}
        />
    )
}
